﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using xinyue.game.common;

public class SystemConfigManager 
{
    private static SystemConfig systemConfig;
   public static void UpdateSystemConfig(SystemConfig systemConfig)
    {
        SystemConfigManager.systemConfig = systemConfig;
        string json = JsonUtil.ToJson(systemConfig);
        PlayerPrefs.SetString("systemConfig", json);
    }

    public static SystemConfig GetSystemConfig()
    {
        if (systemConfig != null)
        {
            return systemConfig;
        }
        string json = PlayerPrefs.GetString("systemConfig");
        if (json == null)
        {
            systemConfig = new SystemConfig();

        }
        else
        {
            systemConfig = JsonUtil.ToObject<SystemConfig>(json);
        }

        return systemConfig;
    }
}
